import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

/**
 * tester for the savings account class.
 * @author Kyle Scharnhorst/Kristopher Gooding
 * @version 4/25/2014
 */
public class SavingsAccountTest {

	/**savings account to be tested.*/
	private SavingsAccount the_account;

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() {
		the_account = new SavingsAccount("Bob", "Bob St", "12345", "Bobtown",
				"Bobcountry");
	}

	/**
	 * Test method for
	 * {@link SavingsAccount#SavingsAccount(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)}
	 * .
	 */
	@Test
	public void testSavingsAccount() {
		assertTrue("Bob".equals(the_account.getMember().getName()));
		assertTrue("Bob St".equals(the_account.getMember().getAddress()
				.getStreet()));
		assertTrue("12345".equals(the_account.getMember().getAddress()
				.getZipCode()));
		assertTrue("Bobtown".equals(the_account.getMember().getAddress()
				.getTown()));
		assertTrue("Bobcountry".equals(the_account.getMember().getAddress()
				.getCountry()));
		the_account = new SavingsAccount(345);
		assertEquals(345, the_account.getAccountNumber());
	}

	/**
	 * Test method for {@link SavingsAccount#calculateInterest()}.
	 */
	@Test
	public void testCalculateInterest() {
		the_account.verseMoney(100);
		the_account.calculateInterest();
		assertEquals(101.25, the_account.getBalance(), 0);
	}

	/**
	 * Test method for {@link SavingsAccount#withdrawal(double)}.
	 */
	@Test
	public void testWithdrawal() {
		the_account.verseMoney(100);
		the_account.withdrawal(50);
		assertEquals(50, the_account.getBalance(), 0);
	}

	/**
	 * Test method for {@link SavingsAccount#withdrawal(double)}.
	 */
	@Test
	public void testWithdrawalFirstBranch() {
		the_account.verseMoney(100);
		assertFalse(the_account.withdrawal(110));
	}
	
	/**
	 * Test method for {@link SavingsAccount#verseMoney(double)}.
	 */
	@Test
	public void testVerseMoney() {
		the_account.verseMoney(100);
		assertEquals(100, the_account.getBalance(), 0);
	}

	/**
	 * Test method for {@link SavingsAccount#print()}.
	 */
	@Test
	public void testPrint() {
		assertTrue(true);
	}

}
